export default {
  addToCart({ state, commit }, payload) {
    return new Promise((resolve, reject) => {
      let goods = state.cartList.find(item => item.id === payload.id)
      if (goods) {
        commit('addCount', goods)
        resolve('商品数量增加')
      } else {
        payload.count = 1
        payload.checked = true
        commit('addGoods', payload)
        resolve('商品添加成功')
      }
    })
  }
}
